#!/bin/sh

projBin=$GOPATH/src/lottery/bin

sources=`find $projBin -name "cmd_*.go"`
for source in $sources;do
	dir=`dirname $source`
	name=lottery-`basename $dir`-`basename $source .go`
	if go build -o $dir/$name $source;then
		echo "$name build success"
	else
		echo "$name build faild"
		exit 1
	fi
done

supervisorctl restart cmd_policy